/*
 * OpenSCAD File with the code to draw a part of the quadcopter in 3D
 * Part Number: 11
 * Version: 0.01
 * Units: mm
 * Last Modification: Mon Jun 28 19:40:37 WEST 2010
 *
 * Copyright (C) 2010 Henrique Dias <henrique.ribeiro.dias@gmail.com>
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 */

frominclude = 0;

module p11_subcomponent()
{
	rotate(a=[0,90,0]) {
		translate(v = [-(2/2), 0, 0]) {
			cylinder(h=8+4+4+4, r=2, center=true, $fn=60);
		}
	}
	translate(v = [0, 0, -2]) {
		cube(size = [8+4+4+1, 8+4+4+1, 2], center=true);
	}
	translate(v = [0, 0, -1]) {
		cube(size = [8+4+4+1, 2, 2], center=true);
	}
	rotate(a=[0, 0, 90]) {
		for (pos = [[6, 6, 0],[-6, 6, 0],[6, -6, 0],[-6, -6, 0]]) {
			translate(v = pos) {
				cylinder(h=4, r=1, center=true, $fn=60);
			}
		}
	}
	rotate(a=[0, 90, 0]) {
		translate(v = [-3, 6, 0]) {
			cylinder(h=4, r=1, center=true, $fn=60);
		}
	}
	rotate(a=[0, 90, 0]) {
		translate(v = [-3, -6, 0]) {
			cylinder(h=4, r=1, center=true, $fn=60);
		}
	}
}


module p11_addcomponent()
{
	rotate(a=[0,90,0]) {
		translate(v = [-(4/2)+1, 0, 0]) {
			cylinder(h=8+4+4, r=4, center=true, $fn=60);
		}
	}
	cube(size = [8+4+4, 8+4+4, 2], center=true, $fn=60);
	translate(v = [0, 0, (6/2)-1]) {
		cube(size = [2, 8+4+4, 6], center=true, $fn=60);
	}
	rotate(a=[0, 0, 90]) {
		for (pos = [[6, 6, 0],[-6, 6, 0],[6, -6, 0],[-6, -6, 0]]) {
			translate(v = pos) {
				cylinder(h=3, r=2, center=true, $fn=60);
			}
		}
	}
}

module part11()
{
	difference() {
		union() {
			p11_addcomponent();
		}
		p11_subcomponent();
	}
}

if(frominclude == 0) {
	part11();
}
